// run: $exec < input
#include <iostream>
#include <algorithm>
#include <vector>

std::vector<int> a;
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) std::cin >> a[i];
	std::sort(a.begin(), a.end());
	long long ans = 0;
	for (long long i = 0; i < n - 1; i++)
		ans += (i + 2) * a[i];
	ans += (long long)n * a[n - 1];
	std::cout << ans << "\n";
}

